﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Acms.AcmsControls
{
    public class TrueFalseContentControlProperties : BaseContentControlProperties
    {
        public bool Value { get; set; }

        protected override void ReadValue(System.Xml.XmlReader reader)
        {
            if (reader.Name.ToLower() == "value" && reader.NodeType == System.Xml.XmlNodeType.Attribute)
            {
                try
                {
                    Value = bool.Parse(reader.ReadContentAsString());
                }
                catch { }
            }
        }

        protected override void WriterPropertiesToXml(System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("content");
            writer.WriteAttributeString("value", Value.ToString());
            writer.WriteEndElement();
        }
    }
}
